
<style>

    .default,.blue{
        box-shadow: none;
        border: 1px solid;
        text-decoration: none;
        color: #fff;
        display: inline-block;
        padding: 6px 12px;
        margin-bottom: 0;
        font-size: 14px;
        font-weight: 400;
        line-height: 1.42857143;
        text-align: center;
        white-space: nowrap;
        vertical-align: middle;
        -ms-touch-action: manipulation;
        touch-action: manipulation;
        cursor: pointer;
    }
    .blue{
        background: #3c8dbc;
        color: #fff;
    }
</style>




<div class="x-body">
    <form class="layui-form form_single" id="form" action="{:url()}" method="post">
        <div class="layui-form-item">
            <label for="username" class="layui-form-label">
                <span class="x-red">*</span>活动标题
            </label>
            <div class="layui-input-block">
                <input type="text" id="username" name="name" onchange="this.value=this.value.substring(0, 30)" onkeydown="this.value=this.value.substring(0, 30)" onkeyup="this.value=this.value.substring(0, 30)" required="" lay-verify="required"
                       autocomplete="off"  value="{$info['name']|default=''}" class="layui-input">
            </div>
            <div style="color: red !important;" class="layui-form-mid layui-word-aux">
                （限制30字符）
            </div>
        </div>

        <div class="layui-form-item">
            <label for="L_pass" class="layui-form-label">
             排序
            </label>
            <div class="layui-input-block">
                <input type="number" id="L_pass" name="sort"
                       autocomplete="off" class="layui-input"  value="{$info['sort']|default=0}">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (排序)
            </div>
        </div>

        <div class="layui-form-item">
            <label for="address" class="layui-form-label">
                <span class="x-red">*</span>活动地址
            </label>
            <div class="layui-input-block">
                <input type="text" id="address" name="address" required="" lay-verify="required"
                       autocomplete="off"  value="{$info['address']|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (活动地址)
            </div>
        </div>

        <div class="layui-form-item">
            <label for="time" class="layui-form-label">
                <span class="x-red">*</span>活动时间
            </label>
            <div class="layui-input-block">
                <input type="text" id="time" name="time" required="" lay-verify="required"
                       autocomplete="off"  value="{$info['time']|default=''}" class="layui-input">
            </div>
            <div class="layui-form-mid layui-word-aux">
                (活动时间)
            </div>
        </div>



        <div class="layui-form-item">
            <label for="logo" class="layui-form-label">
                <span class="x-red">*</span>封面图片（165*128）
            </label>
            <div id="logo" class="layui-input-block">
                {assign name="cover_id" value="$info.cover_id|default='0'" /}
                {:widget('file/index', ['name' => 'cover_id', 'value' => $cover_id, 'type' => 'img'])}
            </div>
            <!--<div class="layui-form-mid layui-word-aux">-->
                <!--(请上传单张封面图片)-->
            <!--</div>-->
        </div>



        <div class="layui-form-item">
            <label class="layui-form-label">
                活动嘉宾
            </label>
            <div class="layui-input-block">
                {volist name='tags' id='vo'}
                <button type="button"  data-id="{$vo.id}" { {if condition=" isset($info)   &&  in_array($vo['id'],$info['tags_array']) eq true "} class="blue" {else/}class="default" {/if} >{$vo['name']}</button>
                {/volist}
            </div>
            <input type="hidden" name="tags"  value="{$info['tags']|default=''}"/>


            <!--<div class="layui-form-mid layui-word-aux">-->
            <!--(文章描述信息/简介)-->
            <!--</div>-->
        </div>





        <div class="layui-form-item">
            <label class="layui-form-label">
                <span class="x-red">*</span>活动介绍
            </label>
            <div class="layui-input-block">
                <textarea class="form-control textarea_editor" name="content" placeholder="请输入人生履历">{$info['content']|default=''}</textarea>
                {:widget('editor/index', array('name'=> 'content','value'=> ''))}
            </div>
        </div>



        <div class="box-footer">
            <input type="hidden" name="type" value="{:input('type')}"/>
            <input type="hidden" name="id" value="{$info['id']|default='0'}"/>

            {include file="layout/edit_btn_group"/}

        </div>

    </form>
</div>
<script>
    $("body").on('click','.default',function () {

        $(this).removeClass('default');
        $(this).addClass('blue');
        var len= $('.blue').length;
        var str=',';
        for (var i=0; i<len;i++){
            str+=$('.blue').eq(i).attr('data-id')+',';
        }
        $("[name='tags']").val(str);

    })

    $("body").on('click','.blue',function () {
        $(this).removeClass('blue');
        $(this).addClass('default');
        var len= $('.blue').length;
        var str=',';
        for (var i=0; i<len;i++){
            str+=$('.blue').eq(i).attr('data-id')+',';
        }
        $("[name='tags']").val(str);

    })






</script>

<script>
    layui.use('form', function(){
        var form = layui.form;

        form.on('select(aihao)', function(data){
            console.log(data.elem); //得到select原始DOM对象
            console.log(data.value); //得到被选中的值
            console.log(data.othis); //得到美化后的DOM对象
            if(data.value==1){
                $('#video_url').hide();
                $('#video').show();
            }else{
                $('#video_url').show();
                $('#video').hide();
            }

            form.render(null, 'form');
        });


    });


    function changevideo(v) {
        if(v==1){
            $('#video').show();
            $('#video_url').hide();
        }else{
            $('#video_url').show();
            $('#video').hide();
        }
    }
</script>
